﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace Helpers
{
    public class ConfigHelpers
    {
        #region FTP Connection Related Properties

        public static String FTPHost
        {
            get
            {
                String ftpHost = ConfigurationManager.AppSettings["FTP_Host"].ToString();

                if (!String.IsNullOrEmpty(ftpHost))
                {
                    return ftpHost;
                }
                else
                {
                    return null;
                }
            }
        }

        public static int FTPPort
        {
            get
            {
                String ftpPort = ConfigurationManager.AppSettings["FTP_Port"].ToString();

                if (!String.IsNullOrEmpty(ftpPort))
                {
                    return Convert.ToInt32(ftpPort);
                }
                else
                {
                    return 0;
                }
            }
        }

        
        public static String FTPUserName
        {
            get
            {
                String ftpUserName = ConfigurationManager.AppSettings["FTP_UserName"].ToString();

                if (!String.IsNullOrEmpty(ftpUserName))
                {
                    return ftpUserName;
                }
                else
                {
                    return null;
                }
            }
        }


        public static String FTPPassword
        {
            get
            {
                String ftpUserName = ConfigurationManager.AppSettings["FTP_Password"].ToString();

                if (!String.IsNullOrEmpty(ftpUserName))
                {
                    return ftpUserName;
                }
                else
                {
                    return null;
                }
            }
        }
        #endregion

        #region Campaign Owner Name

        public static String CampaignOwnerName
        {
            get
            {
                String campaignOwnerName = ConfigurationManager.AppSettings["CAMPAIGN_OWNER_NAME"].ToString();

                if (!String.IsNullOrEmpty(campaignOwnerName))
                {
                    return campaignOwnerName;
                }
                else
                {
                    return null;
                }
            }
        }


        #endregion

        #region Upload Directory For Local and SilverPOP FTP

        public static String LocalUploadDirectoryName
        {
            get
            {
                String directoryName = ConfigurationManager.AppSettings["LOCAL_UPLOAD_DIRECTORY_NAME"].ToString();

                if (!String.IsNullOrEmpty(directoryName))
                {
                    return directoryName;
                }
                else
                {
                    return null;
                }
            }
        }

        public static String FTPUploadDirectoryName
        {
            get
            {
                String directoryName = ConfigurationManager.AppSettings["FTP_UPLOAD_DIRECTORY_NAME"].ToString();

                if (!String.IsNullOrEmpty(directoryName))
                {
                    return directoryName;
                }
                else
                {
                    return null;
                }
            }
        }

       #endregion

        #region Download Directory For Local and SilverPOP FTP

        public static String LocalDownloadDirectoryName
        {
            get
            {
                String directoryName = ConfigurationManager.AppSettings["LOCAL_DOWNLOAD_DIRECTORY_NAME"].ToString();

                if (!String.IsNullOrEmpty(directoryName))
                {
                    return directoryName;
                }
                else
                {
                    return null;
                }
            }
        }

        public static String FTPDownloadDirectoryName
        {
            get
            {
                String directoryName = ConfigurationManager.AppSettings["FTP_DOWNLOAD_DIRECTORY_NAME"].ToString();

                if (!String.IsNullOrEmpty(directoryName))
                {
                    return directoryName;
                }
                else
                {
                    return null;
                }
            }
        }

        #endregion

        #region SilverPOP Data Update Directory For Local

        public static String LocalSilverPOPDataUpdateDirectoryName
        {
            get
            {
                String directoryName = ConfigurationManager.AppSettings["LOCAL_DATA_UPDATE_SILVER_POP_DIRECTORY_NAME"].ToString();

                if (!String.IsNullOrEmpty(directoryName))
                {
                    return directoryName;
                }
                else
                {
                    return null;
                }
            }
        }

        #endregion

        #region SilverPOP Summary Data Local Directory

        public static String LocalSilverPOPSummaryDirectoryName
        {
            get
            {
                String directoryName = ConfigurationManager.AppSettings["LOCAL_SILVER_POP_SUMMARY_DIRECTORY_NAME"].ToString();

                if (!String.IsNullOrEmpty(directoryName))
                {
                    return directoryName;
                }
                else
                {
                    return null;
                }
            }
        }

        #endregion

        #region SilverPOP Database Column's Value During Data Sync

        public static String CampaignPartUrl
        {
            get
            {
                String campaignPartUrl = ConfigurationManager.AppSettings["CAMPAIGN_PART_URL"].ToString();

                if (!String.IsNullOrEmpty(campaignPartUrl))
                {
                    return campaignPartUrl;
                }
                else
                {
                    return null;
                }
            }
        }

        public static String Academics
        {
            get
            {
                String academics = ConfigurationManager.AppSettings["ACADEMICS"].ToString();

                if (!String.IsNullOrEmpty(academics))
                {
                    return academics;
                }
                else
                {
                    return null;
                }
            }
        }


        public static String CampaignCode
        {
            get
            {
                String campaignCode = ConfigurationManager.AppSettings["CAMPAIGN_CODE"].ToString();

                if (!String.IsNullOrEmpty(campaignCode))
                {
                    return campaignCode;
                }
                else
                {
                    return null;
                }
            }
        }

        public static String Segment
        {
            get
            {
                String segment = ConfigurationManager.AppSettings["SEGMENT"].ToString();

                if (!String.IsNullOrEmpty(segment))
                {
                    return segment;
                }
                else
                {
                    return null;
                }
            }
        }



        public static String UniquelyPenn
        {
            get
            {
                String uniquelyPenn = ConfigurationManager.AppSettings["UNIQUELY_PENN"].ToString();

                if (!String.IsNullOrEmpty(uniquelyPenn))
                {
                    return uniquelyPenn;
                }
                else
                {
                    return null;
                }
            }
        }


        public static String FinancialAids
        {
            get
            {
                String financialAids = ConfigurationManager.AppSettings["FINANCIAL_AIDS"].ToString();

                if (!String.IsNullOrEmpty(financialAids))
                {
                    return financialAids;
                }
                else
                {
                    return null;
                }
            }
        }

        public static String Business
        {
            get
            {
                String business = ConfigurationManager.AppSettings["BUSINESS"].ToString();

                if (!String.IsNullOrEmpty(business))
                {
                    return business;
                }
                else
                {
                    return null;
                }
            }
        }


        public static String Nursing
        {
            get
            {
                String nursing = ConfigurationManager.AppSettings["NURSING"].ToString();

                if (!String.IsNullOrEmpty(nursing))
                {
                    return nursing;
                }
                else
                {
                    return null;
                }
            }
        }


        public static String Arts
        {
            get
            {
                String arts = ConfigurationManager.AppSettings["ARTS"].ToString();

                if (!String.IsNullOrEmpty(arts))
                {
                    return arts;
                }
                else
                {
                    return null;
                }
            }
        }


        public static String Engineering
        {
            get
            {
                String engineering = ConfigurationManager.AppSettings["ENGINEERING"].ToString();

                if (!String.IsNullOrEmpty(engineering))
                {
                    return engineering;
                }
                else
                {
                    return null;
                }
            }
        }


        public static String SchemaMapperFileWithContactList
        {
            get
            {
                String schemaMapperFile = ConfigurationManager.AppSettings["SCHEMA_MAPPER_WITH_CONTACT_LIST_XML_FILE"].ToString();

                if (!String.IsNullOrEmpty(schemaMapperFile))
                {
                    return schemaMapperFile;
                }
                else
                {
                    return null;
                }
            }

        }

        public static String SchemaMapperFileWithOutContactList
        {
            get
            {
                String schemaMapperFile = ConfigurationManager.AppSettings["SCHEMA_MAPPER_WITH_OUT_CONTACT_LIST_XML_FILE"].ToString();

                if (!String.IsNullOrEmpty(schemaMapperFile))
                {
                    return schemaMapperFile;
                }
                else
                {
                    return null;
                }
            }

        }

        public static String UnSubscribePageName
        {
            get
            {
                String unsribePageName = ConfigurationManager.AppSettings["UNSUBSCRIBE_PAGE_NAME"].ToString();

                if (!String.IsNullOrEmpty(unsribePageName))
                {
                    return unsribePageName;
                }
                else
                {
                    return null;
                }
            }

        }

        public static String IsSubmitted
        {
            get
            {
                String isSubmitted = ConfigurationManager.AppSettings["IS_SUBMITTED"].ToString();

                if (!String.IsNullOrEmpty(isSubmitted))
                {
                    return isSubmitted;
                }
                else
                {
                    return null;
                }
            }

        }


        public static String IsOptedOut
        {
            get
            {
                String isOptedOut = ConfigurationManager.AppSettings["IS_OPTED_OUT"].ToString();

                if (!String.IsNullOrEmpty(isOptedOut))
                {
                    return isOptedOut;
                }
                else
                {
                    return null;
                }
            }
        }

        public static String IsBounced
        {
            get
            {
                String isBounced = ConfigurationManager.AppSettings["IS_BOUNCED"].ToString();

                if (!String.IsNullOrEmpty(isBounced))
                {
                    return isBounced;
                }
                else
                {
                    return null;
                }
            }
        }

        public static String IsDeleted
        {
            get
            {
                String isDeleted = ConfigurationManager.AppSettings["IS_DELETED"].ToString();

                if (!String.IsNullOrEmpty(isDeleted))
                {
                    return isDeleted;
                }
                else
                {
                    return null;
                }
            }

        }



        #endregion

        #region Get Connection String
        public static String SQLConnectionString
        {
            get
            {
                String connectionString = ConfigurationManager.AppSettings["SQL_CONNECTION_STRING"].ToString();

                if (!String.IsNullOrEmpty(connectionString))
                {
                    return connectionString;
                }
                else
                {
                    return null;
                }
            }
        }
        #endregion

        #region Get Dev Database Connection String's Part
        
        public static String DEVSQLConnectionStringPart
        {
            get
            {
                String connectionString = ConfigurationManager.AppSettings["DEV_CONNECTION_STRING_PART"].ToString();

                if (!String.IsNullOrEmpty(connectionString))
                {
                    return connectionString;
                }
                else
                {
                    return null;
                }
            }
        }

        #endregion

        #region Waiting Time Or Thread Sleep Time

        public static int WaitingTimePerFile
        {
             get
             {
                 String waitingTime = ConfigurationManager.AppSettings["WAITING_TIME_PER_FILE"].ToString();

                 if (!String.IsNullOrEmpty(waitingTime))
                 {
                     return Convert.ToInt32(waitingTime.Trim());
                 }
                 return 30000;
             }

         }

         
        public static int OverAllWaitingTime
        {
             get
             {
                 String waitingTime = ConfigurationManager.AppSettings["OVERALL_WAITING_TIME"].ToString();

                 if (!String.IsNullOrEmpty(waitingTime))
                 {
                     return Convert.ToInt32(waitingTime.Trim());
                 }
                 return 60000;
             }

         }
        #endregion


        #region Job Status Checking Loop Count  And Waiting Time Before  Re-Checking Job Status
        public static int JobStatusCheckingLoopCount
        {
            get
            {
                int loopCount = Convert.ToInt32(ConfigurationManager.AppSettings["JOB_STATUS_CHECKING_LOOP_COUNT"].ToString());
                return loopCount;
            }
        }

        public static int JobStatusCheckingWaitingTime
        {
            get
            {
                int waitingTime = Convert.ToInt32(ConfigurationManager.AppSettings["JOB_STATUS_CHECKING_WAITING_TIME"].ToString());
                return waitingTime;
            }
        }
        #endregion

        #region Get Raw Report Tracking Start Time
        public static DateTime TrackingStartTime
        {
            get
            {
                int month, day, year, hour, minute, second;
                String hrMinSec = ConfigurationManager.AppSettings["TRACKING_START_TIME"].ToString();

                month = Convert.ToInt32(ConfigurationManager.AppSettings["TRACKING_START_MONTH"].ToString());
                day = Convert.ToInt32(ConfigurationManager.AppSettings["TRACKING_START_DAY"].ToString());
                year = Convert.ToInt32(ConfigurationManager.AppSettings["TRACKING_START_YEAR"].ToString());
                hour = Convert.ToInt32(hrMinSec.Split(':')[0]);
                minute = Convert.ToInt32(hrMinSec.Split(':')[1]);
                second = Convert.ToInt32(hrMinSec.Split(':')[2]);

                return new DateTime(year, month, day, hour, minute, second);
            }
                
        }

        #endregion


        #region Get Raw Report Tracking End Time
        public static DateTime TrackingEndTime
        {
            get
            {
                int month, day, year, hour, minute, second;
                String hrMinSec = ConfigurationManager.AppSettings["TRACKING_END_TIME"].ToString();

                month = Convert.ToInt32(ConfigurationManager.AppSettings["TRACKING_END_MONTH"].ToString());
                day = Convert.ToInt32(ConfigurationManager.AppSettings["TRACKING_END_DAY"].ToString());
                year = Convert.ToInt32(ConfigurationManager.AppSettings["TRACKING_END_YEAR"].ToString());
                hour = Convert.ToInt32(hrMinSec.Split(':')[0]);
                minute = Convert.ToInt32(hrMinSec.Split(':')[1]);
                second = Convert.ToInt32(hrMinSec.Split(':')[2]);

                //return new DateTime(year, month, day, hour, minute, second);
                return DateTime.Now.AddDays(2);
            }

        }

        #endregion


    }//end class
}
